package com.lagou.dao;/*
 *Author:cxz
 *@Date:${Date}
 */

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface CodeMapper extends BaseMapper {
    @Select("select code from cxz_cod where email=#{email}" +
            "  and  UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(create_time)<10*60 order by create_time limit 1 ")
    public String getCodeByEmail(String email);

    @Insert("insert into cxz_cod (email,code)values(#{email},#{code})")
    public void saveCode(@Param("email") String email, @Param("code") String code);
}
